#include<stdio.h>
int main()
{
    struct person{
        char name[10];
        float jbgz;
        float fdgz;
        float out;
    };
    int n;
    scanf("%d",&n);
    struct person stuff[n];
    for(int i=0;i<n;i++)
        scanf("%s%f%f%f",stuff[i].name,&stuff[i].jbgz,&stuff[i].fdgz,&stuff[i].out);
    for(int i=0;i<n;i++)
        printf("%s %.2f\n",stuff[i].name,stuff[i].jbgz+stuff[i].fdgz-stuff[i].out);
}


#include<stdio.h>
int main(){
    struct stuff{
        char name[10];
        float jbgz;
        float fdgz;
        float zc;
    };
    int n;
    scanf("%d",&n);
    struct stuff stuffs[n];
    for(int i=0;i<n;i++)
        scanf("%s %f %f %f",stuffs[i].name,&stuffs[i].jbgz,
        &stuffs[i].fdgz,&stuffs[i].zc);
     for(int i=0;i<n;i++)
         printf("%s %.2f\n",stuffs[i].name,stuffs[i].jbgz+stuffs[i].fdgz-stuffs[i].zc);
}
